﻿using System;
using System.Linq.Expressions;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.OrderDetails
{
    public class OrderDetailIdSpecification : Specification<OrderDetail>
    {
        #region public properties

        public Guid OrderDetailId
        {
            get;
            set;
        }

        #endregion

        #region constructor

        public OrderDetailIdSpecification(Guid orderDetailId)
        {
            this.OrderDetailId = orderDetailId;
        }

        #endregion

        #region public methods

        public override Expression<Func<OrderDetail, bool>> SatisfiedBy()
        {
            Specification<OrderDetail> spec = new TrueSpecification<OrderDetail>();
            spec &= new DirectSpecification<OrderDetail>(c => c.OrderDetailId == this.OrderDetailId);

            return spec.SatisfiedBy();
        }

        #endregion
    }
}
